// var gui = require("nw.gui");
// var win = gui.Window.get();
// var os = require("os");
// var fs = require("fs");

function init() {
    var dirSpan = $("#btn-currentDir").find("span");
    var defaultDirPath = config["default.dir.path"];
    dirSpan.after(defaultDirPath);
}


$(function () {
    init();

    var defaultDir = config["default.dir.path"];

    $("#btn-currentDir").click(function () {
        new PFile(defaultDir).openInOS();
    });

    $("#btn-joinV").click(function () {
        $("body").mLoading("show");
        p = {
            cmd: IMG_CMD_JOIN_V,
            dirPath: defaultDir,
            isDeleteOld: true,
            cmdType: "allInOne"
        }
        imgop.cmdByDirIncludeSon(p);
        $("body").mLoading("hide");
    });


    $("#btn-quality75").click(function () {
        $("body").mLoading("show");
        p = {
            cmd: IMG_CMD_QUALITY_75,
            dirPath: defaultDir,
            isDeleteOld: true,
            cmdType: "oneByOne"
        }
        imgop.cmdByDirIncludeSon(p);
        $("body").mLoading("hide");
    });
    $("#btn-quality20").click(function () {
        $("body").mLoading("show");
        p = {
            cmd: IMG_CMD_QUALITY_20,
            dirPath: defaultDir,
            isDeleteOld: true,
            cmdType: "oneByOne"
        }
        imgop.cmdByDirIncludeSon(p); $("body").mLoading("hide");
    });
    $("#btn-quality50").click(function () {
        $("body").mLoading("show");
        p = {
            cmd: IMG_CMD_QUALITY_50,
            dirPath: defaultDir,
            isDeleteOld: true,
            cmdType: "oneByOne"
        }
        imgop.cmdByDirIncludeSon(p); $("body").mLoading("hide");
    });
});


